<div class="container-fluid">
    <div class="wrapper">
        <div class="panel" id="nav">
            <div class="panel-heading"><h3 class="panel-title">FBA平台账号库存明细</h3></div>
            <div class="panel-body">
                <form action="__URL__/account" method="get">
                    <div class="container-fluid">
                        <div class="col-sm-6 col-md-2 add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">账号</span>
                                <select class="chosen-select form-control" tabindex="-1" name="accountId"
                                        data-name-group="common">
                                    <option value="" class="empty-opt">-- 请选择 --</option>
                                    <volist name="accounts" id="acc">
                                        <option value="{$acc.id}">{$acc.name}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>
                        <div class="col-sm-6 col-md-2 add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">站点</span>
                                <select class="chosen-select form-control" tabindex="-1" name="siteId"
                                        data-name-group="common">
                                    <option value="" class="empty-opt">-- 请选择 --</option>
                                    <volist name="sites" id="value" key="key">
                                        <option value="{$key}">{$value}</option>
                                    </volist>
                                </select>
                            </div>
                        </div>

                        <div class="col-sm-6 col-md-2 add-space">
                            <div class="input-group input-group-md">
                                <span class="input-group-addon">公司内部SKU</span>
                                <input class="form-control" placeholder="请输入公司内部SKU" type="text" name="privateSku">
                            </div>
                        </div>

                        <div class="col-md-6 add-space">
                            <input class="btn btn-primary" type="submit" value="搜索">
                            <input class="btn btn-warning" type="button" onclick="download();" value="导出明细">
                        </div>
                    </div>
                </form>
                <table class="table table-striped  table-hover" cellspacing="0" width="100%">
                    <thead>
                    <tr style="align-content: center">
                        <th colspan="3" class="text-center">账号数据</th>
                        <th colspan="3" class="text-center">SKU数据</th>
                        <th colspan="6" class="text-center">库存数据</th>
                        <th colspan="1" class="text-center">数据时间</th>
                    </tr>
                    <tr>
                        <th>账号</th>
                        <th>站点</th>
                        <th>销售员</th>
                        <th>平台SKU</th>
                        <th>ASIN</th>
                        <th>内部SKU</th>
                        <th>FBA实际库存</th>
                        <th>待发货数量</th>
                        <th>已发货数量</th>
                        <th>待FBA上架库存</th>
                        <th>FBA在途库存（待发货数量 + 已发货数量 + 待FBA上架库存）</th>
                        <th>总可用库存</th>
                        <th>最近更新时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="accountData" id="val">
                        <tr>
                         <td>{$val.accountName}</td>
                         <td>{$val.siteName}</td>
                         <td>{$val.sellerName}</td>
                         <td>{$val.sellerSku}</td>
                         <td>{$val.asin}</td>
                         <td>{$val.privateSku}</td>
                         <td>{$val.localQty}</td>
                         <td>{$val.workingQty}</td>
                         <td>{$val.shippedQty}</td>
                         <td>{$val.receivingQty}</td>
                         <td>{$val.totalOnWayQty}</td>
                         <td>{$val.totalQty}</td>
                         <td>{$val.calDate}</td>
                        </tr>
                    </volist>

                </table>
                <div class="row">
                    <div class="col-md-6" id="container1" style="border:1px solid #ccc; margin-bottom:20px;"></div>
                    <div class="col-md-6" id="container2" style="border:1px solid #ccc; margin-bottom:20px;"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" charset="utf-8">
    function download() {
        var accountId = $("select[name='accountId']").val();
        var privateSku = $("input[name='privateSku']").val();
        var siteId = $("select[name='siteId']").val();
        var param = 'type=detail&accountId=' + accountId + '&siteId=' + siteId + '&privateSku=' + privateSku;

        window.location.href = '__URL__/download?' + param;
    };
</script>




